<?php $this->load->view('layout/header'); ?>

<?php
$url = '&ascdesc=' . ($where['ascdesc'] == 'asc' ? 'desc' : 'asc');
$url.='&parentid=' . $where['parentid'];
$url.='&classname=' . (isset($where['classname']) ? $where['classname'] : '');
$url.='&isclose=' . (isset($where['isclose']) ? $where['isclose'] : '') . '&page=1';

if ($where['ascdesc'] == 'desc') {
    $img[$where['orderkey']] = '<img src="/static/bk/images/down.gif"/>';
} else {
    $img[$where['orderkey']] = '<img src="/static/bk/images/up.gif"/>';
}
?>

<form name="form1" method="get" action="<?php echo b_url('columns/index') ?>" id="form1">
    <div id="container">
        <!--查询表单开始-->
        <div id="DivQuery">
            <div id="floatBoxBg" style="filter: alpha(opacity=0); opacity: 0;">
            </div>
            <div id="floatBox" class="floatBox">
                <div id="drag" class="title" onmousedown="DragDialog()">
                    <h4>查询</h4>
                    <span>关闭</span></div>
                <div class="content">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_query">
                        <tr class="table_query_row">
                            <td style="width: 15%" align="right">
                                栏目名称：
                            </td>
                            <td>
                                <input name="classname" type="text" value="<?php echo isset($where['classname'])?$where['classname']:'';?>" id="classname" />
                            </td>
                            <td style="width: 15%" align="right">
                                状态：
                            </td>
                            <td>
                                <?php 
                                if(!isset($where['isclose'])){
                                    $where['isclose']=-1;
                                }
                                ?>
                                <span id="radIsClose">
                                    <input id="radIsClose_0" type="radio" name="isclose" value="-1" <?php echo $where['isclose']==-1?'checked="checked" ':'';?>/>
                                    <label for="radIsClose_0">不限</label>
                                    <input id="radIsClose_1" type="radio" name="isclose" value="0" <?php echo $where['isclose']==0?'checked="checked" ':'';?>/>
                                    <label for="radIsClose_1">开放</label>
                                    <input id="radIsClose_2" type="radio" name="isclose" value="1" <?php echo $where['isclose']==1?'checked="checked" ':'';?>/>
                                    <label for="radIsClose_2">关闭</label>
                                </span>
                            </td>
                        </tr>
                        <tr class="table_query_btn">
                            <td align="right" style="width: 15%">        </td>
                            <td>
                                <input type="submit" name="btnQuery" value="查询" id="btnQuery" />
                                <input type="button" value="返回" onclick="javascript:HiddenSearchDialog();" />
                            </td>
                            <td align="right" style="width: 15%">        </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <!--查询表单结束-->
        <!--导航开始-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_nav">
            <tr>
                <td>
                    栏目管理&gt;管理列表(<span id="lblNav">根结点
                        <?php
                        $last_parentid = 0;
                        foreach ($node_list as $k => $v) {
                            echo ' > ' . $v['classname'] . '  ';
                            $last_parentid =$v['parentid'];
                        }
                        ?></span>)</td>
            </tr>
        </table>
        <!--导航结束-->
        <!--操作选项开始-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_op">
            <tr>
                <td>
                    操作选项：
                    <a href="<?php echo b_url('columns/add?parentid='.$where['parentid']); ?>">添加栏目</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('columns/add?classid='); ?>" name="classid" onclick="checkEdit(this);">修改栏目</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('columns/move?classid='); ?>" name="classid" onclick="checkOperate(this);">移动栏目</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('columns/delete?classid='); ?>" name="classid" onclick="checkDel(this);">删除栏目</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('columns/openclose?status=0&classid='); ?>" name="classid" onclick="checkOperate(this);">批量开放</a>
                    <a href="javascript:void(0);" src="<?php echo b_url('columns/openclose?status=1&classid='); ?>" name="classid" onclick="checkOperate(this);">批量关闭</a>
                    <a href="javascript:SearchDialog()">查询栏目</a>
                    <a href="<?php echo b_url('columns/index?parentid='.$last_parentid);?>">返回上级</a>
                </td>
            </tr>
        </table>

        <!--操作选项结束-->
        <!--列表开始-->
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_list" id="TbList">
            <tr class="table_list_title">
                <td style="width: 2%"><input type="checkbox" name="checkbox" value="checkbox" onclick="javascript:checkAll(this, 'classid')" /></td>
                <td style="width: 5%" onclick="javascript:GoTo('?orderkey=classid<?php echo $url; ?>')" title="点击排序">
                    编号<?php echo isset($img['classid']) ? $img['classid'] : '' ?></td>

                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=classname<?php echo $url; ?>')" title="点击排序">
                    栏目名称<?php echo isset($img['classname']) ? $img['classname'] : '' ?></td>

                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=configid<?php echo $url; ?>')" title="点击排序">
                    语言版本<?php echo isset($img['configid']) ? $img['configid'] : '' ?></td>                

                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=classpropertyid<?php echo $url; ?>')" title="点击排序">
                    栏目属性<?php echo isset($img['classpropertyid']) ? $img['classpropertyid'] : '' ?></td>

                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=childnum<?php echo $url; ?>')" title="点击排序">
                    子级数<?php echo isset($img['childnum']) ? $img['childnum'] : '' ?></td>

                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=listid<?php echo $url; ?>')" title="点击排序">
                    排序号<?php echo isset($img['listid']) ? $img['listid'] : '' ?></td>

                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=adminid<?php echo $url; ?>')" title="点击排序">
                    创建人<?php echo isset($img['adminid']) ? $img['adminid'] : '' ?></td>

                <td style="width: 10%" onclick="javascript:GoTo('?orderkey=addtime<?php echo $url; ?>')" title="点击排序">
                    创建时间<?php echo isset($img['addtime']) ? $img['addtime'] : '' ?></td>

                <td style="width: 5%" onclick="javascript:GoTo('?orderkey=isclose<?php echo $url; ?>')" title="点击排序">
                    状态<?php echo isset($img['isclose']) ? $img['isclose'] : '' ?></td>

                <td style="width: 10%">操作</td>
            </tr>

            <?php
            if (!empty($list)) {
                foreach ($list as $k => $v) {
                    ?>
                    <tr class="table_list_row_normal">
                        <td style="width: 2%"><input name="classid" type="checkbox" value="<?php echo $v['classid']; ?>" /></td>
                        <td style="width: 5%"><?php echo $v['classid']; ?></td>
                        <td style="width: 10%"><a href="<?php echo b_url('columns/add?classid=' . $v['classid'] .'&parentid='.$v['parentid']); ?>"><?php echo $v['classname']; ?></a>
                            <?php echo $v['isshownav'] == 1 ? '<span style="color:red"> |显</span>' : ''; ?>
                        </td>
                        <td style="width: 10%"><?php echo isset($config[$v['configid']]['languagever'])?$config[$v['configid']]['languagever']:''; ?></td>
                        <td style="width: 10%"><?php echo isset($class_property[$v['classpropertyid']]['propertyname'])?$class_property[$v['classpropertyid']]['propertyname']:''; ?></td>
                        <td style="width: 10%"><?php echo $v['childnum'] ?></td>
                        <td style="width: 10%"><?php echo $v['listid'] ?></td>
                        <td style="width: 10%"><?php echo isset($admin[$v['adminid']]['adminname'])?$admin[$v['adminid']]['adminname']:''; ?></td>
                        <td style="width: 10%"><?php echo $v['addtime']; ?></td>
                        <td style="width: 5%"><?php echo $v['isclose'] == 1 ? '关闭' : '开放'; ?></td>

                        <td style="width: 10%"><a href="<?php echo b_url('columns/index?parentid=' . $v['classid']); ?>">进入子栏目</a></td>
                    </tr>
                    <?php
                }
            }
            ?>
        </table>

        <?php
        if (!empty($list)) {
            echo $pagination->show();
        } else {
            echo '<div id="pager"><p>查询无相关记录!</p></div>';
        }
        ?>

    </div>
</form>
<script src="/static/bk/js/table.js" type="text/javascript"></script>
<?php $this->load->view('layout/footer'); ?>
